<template>
	<div>
		<el-form ref="form" :model="form" label-width="100px">

			<!-- <el-form-item label="状态" prop="state">
				<el-input v-model="form.state"></el-input>
			</el-form-item> -->
			<el-form-item label="审核意见" prop="auditOpinion">
				<el-input v-model="form.auditOpinion"></el-input>
			</el-form-item>
			<el-form-item label="审核人" prop="auditor">
				<el-input v-model="form.auditor"></el-input>
			</el-form-item>
			<el-form-item label="审核时间" prop="auditTime">
				<el-date-picker v-model="form.auditTime" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
				:style="{width: '100%'}" placeholder="请输入时间" clearable>
				</el-date-picker>
			</el-form-item>
			
			
			
			<el-form-item>
				<el-button type="primary" @click="save">保存</el-button>
			</el-form-item>
		</el-form>
 
	</div>
</template>

<script>
	export default {
		name: 'WorkDiaryAudit',
		components: {

		},
		props: [
			'showAudit',
			'diaryId',
			'auditid'
		],
		data() {
			return {
				form: {
					diaryId: '',
					state: '',
					auditOpinion: '',
					auditor: '',
					auditTime: ''
				},
				// isupdate: false,
				url: '/workDiary/save',
				registerlevel: [],
				depts: [],
			}
		},
		created() {
			// this.init()
			// console.log("this.editid:" + this.editid)
			if (this.auditid) {


				this.axios.get
				this.axios.get('/workDiary/toedit', response => {
					// console.log(response.obj);
					this.form.diaryId = response.obj.diaryId
					// console.log(this.form.id);
					this.form.state = 1
					this.form.auditOpinion = response.obj.auditOpinion
					this.form.auditor = response.obj.auditor
					this.form.auditTime = response.obj.auditTime
				}, {
					id: this.auditid
				})
			}
		},
		methods: {
			save() {
				this.$refs['form'].validate((valid) => {
					if (valid) {
						this.axios.post(this.url, response => {
							// 子组件要改变父组件的值
							this.$emit('update:show', false)
							this.$emit('getData')
						}, this.form)
					}
				})
			}

		}
	}
</script>

<style>
</style>
